package edu.zut.method;

import java.util.Random;
import java.util.Scanner;

public class Demo3 {

    public static void main(String[] args) {
        randomNumber();
    }

    /**
     * 循环输出a-z
     */
    public static void print(){
        char c = 'a';
        for (int i = 0; i < 26; i++) {
            System.out.println(c);
            c ++;
        }
    }


    public static void guestNumber(){
        Random random = new Random();
        //[50,100]
        int r = random.nextInt(51) + 50;
        Scanner scanner = new Scanner(System.in);
        while (true){
            System.out.println("请输入一个数字，范围50-100");
            int i = scanner.nextInt();
            if (i == r){
                System.out.println("输入正确，结束!!!!!!");
                break;
            }
        }
    }
    /**
     * 随机数
     */
    public static void randomNumber(){
        Random random = new Random();
        //随机一个整数   指定范围  0 - 50  [0,50)
        int i = random.nextInt(50);
        //随机一个[30,100)
        i = random.nextInt(70) + 30;
        System.out.println("i = " + i);
        //[50,100]
        int r = random.nextInt(51) + 50;


    }



    /**
     * 1  1  2  3   5   8   13  21  34  55  89......  根据规律计算第十一个数字是多少
     * a  b  c
     *    a  b  c
     *       a  b  c
     *          a  b   c
     */

    public static void sum() {
        int a = 1;
        int b = 1;
        int c = 0;
        for (int i = 0; i < 9; i++) {
            c = a + b;
            a = b;
            b = c;
        }
        System.out.println("c = " + c);
    }


    /**
     * 飞机票打折
     */
    public static void discount() {
        double money = 3000;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入月份：");
        int month = scanner.nextInt();
        System.out.println("请输入头等舱或经济舱");
        String cabin = scanner.next();
        switch (month) {
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
            case 11:
                switch (cabin) {
                    case "头等舱":
                        money = money * 0.9;
                        break;
                    case "经济舱":
                        money = month * 0.8;
                        break;
                }
                break;
            case 12:
            case 1:
            case 2:
            case 3:
                switch (cabin) {
                    case "头等舱":
                        money = money * 0.5;
                        break;
                    case "经济舱":
                        money = month * 0.4;
                        break;
                }
                break;
            default:
                System.out.println("输入错误");
                break;
        }
        System.out.println("价格是：" + money);


    }


}
